package yesjava;

public class Main2 {
    public static void main(String[] args)  /*throws RuntimeException*/ {
//        System.out.println(fnn());
        try {
            System.out.println("好好说话！");
            if (Math.random() >= 0.5) {
                String str = null;
                System.out.println(str.length());
            } else {
                int a = 9 / 0;
            }

        } /*catch (NullPointerException | ArithmeticException  e) { // JDK 1.7  的语法
            System.out.println("11111");
        }*/ catch (NullPointerException e) {
            System.out.println("11111");
        }  catch (ArithmeticException e) {
            System.out.println("222222");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("33333");
        } finally {
            System.out.println("不管刮下雨，我都要执行！");
        }
    }


    public  static int fnn(){

        try {
            System.out.println("呵呵");
            return 99;
        } finally {
            return 100;
        }


    }
}
